<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<html 
	xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:t="http://myfaces.apache.org/tomahawk"> 


	<ui:composition template="t_loggedin.xhtml">

	<ui:define name="javascript">
		<script type="text/javascript">

			function cbTpSelected() {
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_default"].checked=false;
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_postgres"].checked=false;
                                document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_server"].checked=false;
			}

			function cbDefaultSelected() {
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_throughput"].checked=false;
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_postgres"].checked=false;
                                document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_server"].checked=false;
			}
			function cbPostgresSelected() {
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_default"].checked=false;
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_throughput"].checked=false;
                                document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_server"].checked=false;
			}
			function cbServerSelected() {
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_default"].checked=false;
				document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_throughput"].checked=false;
                                document.forms["mqConfigTypeForm"]["mqConfigTypeForm:cb_postgres"].checked=false;
			}

		</script> 
	</ui:define>	

	<ui:define name="menu">
		<h:form>
			<table class="leftmenu">
				<tbody>
					<!-- default menu item, place in all pages -->
					<tr class="leftmenuheader">
						<th colspan="2">
							<h:outputText value="#{msgs['menu.heading.userinfo']}" />						
						</th>
					</tr>
					<tr class="leftmenu">
						<div style="margin-bottom: 2px;margin-top: 2px;">
						<th><h:outputText value="#{msgs['menu.loggedinas']}" /></th>
						<td class="leftmenu"><h:outputText value="#{userMgtBean.user}"/></td>
						</div>
					</tr>				
					
					<!-- Status menu item -->					
					<tr class="leftmenuheader">
						<th colspan="2"><h:outputText value="#{msgs['menu.heading.status']}" /></th>
					</tr>
					<!-- Broker status -->
					<tr class="leftmenu">
						<th><h:outputText value="#{msgs['home.menu.mq']}" /></th>
						<td>
							<h:graphicImage value="images/button-close.png" rendered="#{!brokerBean.started}"/>
							<h:graphicImage value="images/button-max.png" rendered="#{brokerBean.started}"/>
						</td>
					</tr>
					<!-- Router status -->
					<tr class="leftmenu">
						<th><h:outputText value="#{msgs['home.menu.router']}" /></th>
						<td>
							<h:graphicImage value="images/button-close.png" rendered="#{!routerBean.started}"/>
							<h:graphicImage value="images/button-max.png" rendered="#{routerBean.started}"/>
						</td>
					</tr>					
					<!-- ESB status -->
					<tr class="leftmenu">
						<th><h:outputText value="#{msgs['home.menu.esb']}" /></th>
						<td>
							<h:graphicImage value="images/button-close.png" rendered="#{!esbBean.started}"/>
							<h:graphicImage value="images/button-max.png" rendered="#{esbBean.started}"/>
						</td>
					</tr>

					<!-- 'Actions' menu items -->
					<tr class="leftmenuheader">
						<th colspan="2">
							<h:outputText value="#{msgs['menu.heading.actions']}" />
						</th>
					</tr>
					<!-- Manage Broker item -->
					<tr class="leftmenu">						
						<td colspan="2">
							<h:outputLink value="mq.jsf"><h:outputText value="#{msgs['home.menu.action.mq']}" /></h:outputLink>
						</td>
					</tr>
					<!-- Manage Router item -->
					<tr class="leftmenu">						
						<td colspan="2">
							<h:outputLink value="router.jsf"><h:outputText value="#{msgs['home.menu.action.router']}" /></h:outputLink>
						</td>
					</tr>
					<!-- Manage ESB item -->
					<tr class="leftmenu">
						<td colspan="2">
							<h:outputLink value="esb.jsf"><h:outputText value="#{msgs['home.menu.action.esb']}" /></h:outputLink>
						</td>
					</tr>
                    <!-- Control -->
                    <tr class="leftmenuheader">
                        <th colspan="2">
                            <h:outputText value="#{msgs['menu.heading.control']}" />
                        </th>
                    </tr>
                    <tr class="leftmenu">
                        <td colspan="2" width="150px"  align="center">
                            <h:commandButton 
                                    id="JCsonsoleButton"
                                    actionListener="#{appLauncherActionHandler.startJConsole}"
                                    value="#{msgs['config.menu.jconsole']}">
                            </h:commandButton>
                        </td>
                    </tr>					
				</tbody>
			</table>
		</h:form>
	</ui:define>

	<ui:define name="body">
		<!-- MQ startup configuration(file) -->
		<ui:decorate template="faces/conf_broker_config.xhtml" />
		
		<!-- Upload custom ActiveMQ config & start  -->
		<ui:decorate template="faces/broker_uploadconfig.xhtml" />

		<!-- Upload custom Camel config & start  -->
		<ui:decorate template="faces/router_uploadconfig.xhtml" />
		
		<!-- Upload custom Mule config & start  -->
		<ui:decorate template="faces/esb_uploadconfig.xhtml" />
	</ui:define>

</ui:composition>

</html>